package b1.scenes.suspect
{
	import b1.controls.basic.BasicMessage;
	import b1.net.*;
	import b1.players.*;
	import b1.scenes.SceneContainer;
	
	import com.greensock.TweenLite;
	
	import flash.display.Sprite;
	import flash.events.MouseEvent;

	public class SuspectStage extends Sprite
	{
		public var leftAnimal:SuspectAnimal;
		public var animal:AnimalInfo;
		
		private var suspectAnimalTip:BasicMessage;
		
		public function SuspectStage(animal:AnimalInfo)
		{
			super();
			this.animal = animal;
			leftAnimal = new SuspectAnimal(animal, 0);
			addChild(leftAnimal);
			suspectAnimalTip = null;

			this.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
			this.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
		}
		
		private function onMouseOver(event:MouseEvent):void
		{
			if (null ==  suspectAnimalTip)
			{
				var string:String = "单击切换动物侧面";
				suspectAnimalTip = new BasicMessage(string.length * 20, 25, string);
				suspectAnimalTip.x = 360;
				suspectAnimalTip.y = 250;
				var suspect:Suspect = SceneContainer.getInstance().currentScene as Suspect;
				suspect.addChild(suspectAnimalTip);			
			}
			
		}
		
		private function onMouseOut(event:MouseEvent):void
		{
			if (null !=  suspectAnimalTip && null != suspectAnimalTip.parent)
        	{
        		suspectAnimalTip.parent.removeChild(suspectAnimalTip);
        		suspectAnimalTip = null;
        	}
		}
		
		//被击中动画
//		public function animalFallDown():void
//		{
//			this.leftAnimal.setAnimalStatus(0);
//			this.leftAnimal.stopTimer();
//			this.leftAnimal.removeEventListener(MouseEvent.CLICK, leftAnimal.onMouseClick);
//			this.removeEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
//			var suspect:Suspect = SceneContainer.getInstance().currentScene as Suspect;
//			TweenLite.to(this, 0.3, {rotation:90, onComplete:suspect.endMsgBox});
//			
//		}
		
	}
}